<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>管理员列表</title>
    <meta charset="utf-8"/>
    <link rel="stylesheet" href="css/bootstrap.css"/>
</head>
<body>
<div class="container">

    <%@include file="header.jsp" %>

    <div class="text-right"><a class="btn btn-warning" href="admin_add.jsp">添加管理员</a></div>

    <br>

    <table class="table table-bordered table-hover">

        <tr>
            <th width="5%">ID</th>
            <th width="10%">用户名</th>
            <th width="10%">操作</th>
        </tr>

        <c:forEach var="admin" items="${pageInfo.list}">
            <tr>
                <td><p>${admin.id}</p></td>
                <td><p>${admin.username}</p></td>
                <td>
                    <c:if test="${admin.id==1}"><p>系统保护用户</p></c:if>
                    <c:if test="${admin.id>1}">
                        <a class="btn btn-info" href="admin_reset.jsp?id=${admin.id}&username=${admin.username}">重置密码</a>
                        <a class="btn btn-danger" href="adminDelete?id=${admin.id}">删除</a>
                    </c:if>
                </td>
            </tr>
        </c:forEach>

    </table>
    一共${pageInfo.total}条数据 共${pageInfo.pages}页
    <c:if test="${pageInfo.pageNum != pageInfo.firstPage}">
        <a href="${pageContext.request.contextPath}/admin/adminList?page=${pageInfo.pageNum-1}">上一页</a>
    </c:if>
    <c:if test="${pageInfo.pageNum == pageInfo.firstPage}">
        <a href="javascript:void(0)">上一页</a>
    </c:if>
    <c:forEach begin="1" end="${pageInfo.pages}" varStatus="status">
        <c:if test="${status.count == pageInfo.pageNum}">
            <a href="${pageContext.request.contextPath}/admin/adminList?page=${status.count}">${status.count}</a>
        </c:if>
        <c:if test="${status.count != pageInfo.pageNum}">
            <a href="${pageContext.request.contextPath}/admin/adminList?page=${status.count}">${status.count}</a>
        </c:if>
    </c:forEach>
    <c:if test="${pageInfo.pageNum == pageInfo.lastPage}">
        <a href="javascript:void(0)">下一页</a>
    </c:if>
    <c:if test="${pageInfo.pageNum != pageInfo.lastPage}">
        <a href="${pageContext.request.contextPath}/admin/adminList?page=${pageInfo.pageNum+1}">下一页</a>
    </c:if>
</div>
</body>
</html>

